//
//  UIButtonItem+Extensions.swift
//  weibo
//
//  Created by z先生 on 17/1/9.
//  Copyright © 2017年 SZT. All rights reserved.
//

import UIKit

extension UIBarButtonItem{
    
    convenience init(title:String,fontSize: CGFloat = 16,target:AnyObject?,action:Selector,isBackButton: Bool = false) {
        
        let btn = UIButton.cz_textButton(title, fontSize: fontSize, normalColor: UIColor.darkGray, highlightedColor: UIColor.orange)
        
        if isBackButton {
            
            btn?.setImage(UIImage(named: "navigationbar_back_withtext"), for: .normal)
            
            btn?.setImage(UIImage(named: "navigationbar_back_withtext_highlighted"), for: .highlighted)
            
            btn?.sizeToFit()
        }
        btn?.addTarget(target, action: action, for: .touchUpInside)
        
        self.init(customView: btn!)
        
        
        
    }
}
